package com.fancy.social.controller;

import com.fancy.social.dto.DynamicCreateDTO;
import com.fancy.social.service.DynamicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/dynamics")
public class DynamicController {

    @Autowired
    private DynamicService dynamicService;

    @PostMapping
    public ResponseEntity<Void> createDynamic(@RequestHeader("X-User-Id") Long userId, @RequestBody DynamicCreateDTO dynamicCreateDTO) {
        dynamicService.createDynamic(userId, dynamicCreateDTO);
        return ResponseEntity.ok().build();
    }

    @DeleteMapping("/{dynamicId}")
    public ResponseEntity<Void> deleteDynamic(@RequestHeader("X-User-Id") Long userId, @PathVariable Long dynamicId) {
        dynamicService.deleteDynamic(userId, dynamicId);
        return ResponseEntity.ok().build();
    }
}
